<section id="content">
  <?php if (!empty ($request->pattern)): ?>
  <div class="block">
    <header>
      <h2>Přijímací řízení - <?php echo $request->fullname ?></h2>
    </header>
    <section class="block-body">
      <p><?php echo $request->about ?></p>
      <div id="photo-images">
      <?php
      if ($handle = opendir('files/requests/'.$request->date.'/')) {
          while (false !== ($file = readdir($handle))) {
              if ($file != "." && $file != "..") {
                  echo '<img src="/files/requests/'.$request->date.'/'.$file.'" />';
              }
          }
          closedir($handle);
      }
      ?>
      </div>
    </section>
  </div>
  <div class="block-bottom"></div>
  <?php if (Auth::instance()->logged_in()): ?>
  <div class="block">
    <header>
      <h2>Hlasování o přijetí</h2>
    </header>
    <section class="voting">
      <form action="<?php echo url::base(); ?>request/vote" method="post">
          <fieldset>
            <ul>
              <li>
                <label for="yes"><input type="radio" id="yes" name="vote" value="1" <?php if($request_vote->vote == 1) {echo 'checked="checked"';} ?>/>Hlasuji pro přijetí</label>
                <label for="no"><input type="radio" id="no" name="vote" value="0" <?php if($request_vote->vote == 0) {echo 'checked="checked"';} ?>/>Hlasuji proti přijetí</label>
                <label for="cancel"><input type="radio" id="cancel" name="vote" value="2" <?php if($request_vote->vote == 2) {echo 'checked="checked"';} ?>/>Zdržuji se hlasování</label>
                <input class="submit" type="submit" name="form-submit" value="Hlasovat"  />
              </li>
            </ul>
            <?php echo Form::hidden('rid', $request->pattern); ?>
          </fieldset>
        </form>
    </section>
  </div>
  <div class="block-bottom"></div>
  <?php endif ?>
  <div class="block">
    <header>
      <h2>Komentáře</h2>
    </header>
    <!-- HTML5 sekce pro reference -->
    <section class="block-body">
      <form action="<?php echo url::base(); ?>comments/request_add" method="post">
        <ul>
          <li>
            <textarea cols="10" rows="10" name="ctext" class="text-big" ></textarea>
          </li>
          <li class="submit"><?php echo Form::submit(NULL, 'Přidat komentář'); ?></li>
        </ul>
        <?php echo Form::hidden('rid', $request->pattern); ?>
      </form>
      <?php foreach ($comments as $item): ?>
      <div class="comment"><?php echo nl2br($item->text); ?></div>
      <div class="comment-bottom"><?php echo $item->username .' ('.Helpers_Photovoice::datum($item->date). ')'; ?></div>
      <?php endforeach ?>
      <br />
      <div class="clear-both"></div>
    </section>
  </div>
  <div class="block-bottom"></div>
  <?php endif ?>
</section>

